<?php
namespace frontend\controllers;

use Yii;
use yii\web\Controller;
use common\models\Test;
class TestController extends Controller{

	public function actionIndex(){
		$request = Yii::$app->request;
		$model = new Test;
		$model->setScenario('create');
		if($request->isPost && $model->load($request->post())){
			\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
			if($model->save()){
				return true;
			}else{
				return false;
			}
		}

		return $this->renderPartial('index', ['model'=> $model]);
	}
}